<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core-rt" prefix="c-rt" %>
<%@ taglib uri="http://java.jeffheaton.com/taglib/jstl/forum" prefix="forum" %>

<forum:expire>
  <c:redirect url="index.jsp" />
</forum:expire>


<c:if test="${param.mode=='del'}">
  <forum:deleteMessage code="${param.forum}" number="${param.msgnum}"/>

  <c:url value="${pageContext.request.requestURI}" var="rtn">
    <c:param name="id" value="${param.forum}" />
  </c:url>

  <c:redirect url="${rtn}" />
</c:if>

<forum:loadForum var="row" code="${param.id}"/>

<html>
  <head>
    <title><c:out value="${row.name}"/></title>
  </head>

  <body>
    <forum:listMessages var="list" code="${param.id}"/>

    <c:url value="post.jsp" var="post">
      <c:param name="id" value="${param.id}" />
    </c:url>

    <c:if test="${user.type!='G'}">
      <a href="<c:out value="${post}"/>">[
      <fmt:message key="forum.post" bundle="${lang}"/>]</a>
    </c:if>
    <a href="main.jsp">[<fmt:message key="word.exit" bundle="${lang}"/>]</a>

    <br />

    <table border="0" width="668">
      <tr>
        <td colspan="2" valign="top" bgcolor="#0000FF" width="662">
          <p align="center">
            <b>
              <font color="#FFFFFF" size="4">&#160;
              <c:out value="${row.name}" />
              </font>
            </b>
          </p>
        </td>
      </tr>

      <c:forEach var="row" items="${list}"
      varStatus="status">
        <jsp:useBean id="status"
        type="javax.servlet.jsp.jstl.core.LoopTagStatus" />

        <c-rt:choose>
          <c-rt:when test="<%=status.getCount()%2==0%>">
            <c:set var="color" value="#eeeeff" />
          </c-rt:when>

          <c-rt:otherwise>
            <c:set var="color" value="#ddddff" />
          </c-rt:otherwise>
        </c-rt:choose>

        <tr bgcolor="<c:out value="${color}"/>">
        <td width="227" valign="top">
          <table border="0" width="251">
            <tr>
              <td width="49">
                <b><fmt:message key="forum.from" bundle="${lang}"/></b>
              </td>

              <td width="192">
                <c:out value="${row.sender}" />
              </td>
            </tr>

            <tr>
              <td width="49">
                <b><fmt:message key="forum.date" bundle="${lang}"/></b>
              </td>

              <td width="192">
                <fmt:formatDate type="both"
                value="${row.posted}" />
              </td>
            </tr>

            <tr>
              <td width="49">
                <b><fmt:message key="forum.subject" bundle="${lang}"/></b>
              </td>

              <td width="192">
                <c:out value="${row.subject}" />
              </td>
            </tr>
          </table>
        </td>

        <td width="431">
<pre>
<c:out value="${row.message}" />


</pre>

          <c:if test="${user.type=='A'}">
            <c:url value="${pageContext.request.requestURI}"
            var="del">
              <c:param name="mode" value="del" />

              <c:param name="forum" value="${param.id}" />

              <c:param name="msgnum" value="${row.number}" />
            </c:url>

            <a href="<c:out value="${del}"/>">[
            <fmt:message key="word.delete" bundle="${lang}"/>]</a>
          </c:if>
        </td>
        </tr>

      </c:forEach>
    </table>
    <c:if test="${userType!='G'}">
      <a href="<c:out value="${post}"/>">[
      <fmt:message key="forum.post" bundle="${lang}"/>]</a>
    </c:if>
    <a href="main.jsp">[
    <fmt:message key="word.exit" bundle="${lang}"/>]</a>
  </body>
</html>

